package day32;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-04-11 0:14
 */
public class Main1 {
    public static void main(String[] args) {
        //创建输入
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNext()){
            int n=scanner.nextInt();
            long fib1=1;
            long fib2=2;
            if(n==1){
                System.out.println(fib1);
                continue;
            }else if(n==2){
                System.out.println(fib2);
                continue;
            }else{
                long fib3=0;
                for(int i=3;i<=n;++i){
                    fib3=fib1+fib2;
                    fib1=fib2;
                    fib2=fib3;

                }
                //最后判断fib3
                if(fib3>1000000){
                    fib3=fib3%1000000;
                }
                System.out.println(fib3);
            }

        }

    }
}
